<template>
  <div v-for="(item, index) in brands" :key="index" @click="showPicker(item.id)">{{ item.id }}</div>
</template>
<script>
import BrandShop from './241121/BrandShop.class.js'
import weui from '@/libs/weui/weui.min.js'
import '@/libs/weui/weui.min.css'
export default {
  data() {
    return {
      brands: []
    }
  },
  methods: {
    showPicker(id) {
      let columns = Object.assign([], this.brands.find((res) => res.id == id).shops).map((res) => {
        return {
          label: res.alaisName || res.department,
          value: res.shopId,
          brandId: res.brandId,
          brandName: res.brandName
        }
      })
      let defaultValue = [columns[0].value]
      weui.picker(columns, {
        id: 'nocache-' + +new Date(),
        title: '请选择',
        defaultValue,
        onChange(res) {},
        onConfirm: (res) => {}
      })
    }
  },
  mounted() {
    let bs = new BrandShop()
    this.brands = bs.zuhe_brand
  }
}
</script>
